package com.qf.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qf.pojo.DtsAccountTrace;
import com.qf.pojo.DtsBrand;
import com.qf.pojo.DtsUser;
import com.qf.service.DtsAdminBrokerageService;
import com.qf.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/admin/brokerage")
public class DtsAdminBrokerageController {

    @Autowired
    DtsAdminBrokerageService brokerageService;

    @RequestMapping("/list")
    public Object list(
            @RequestParam(name = "page", required = false,defaultValue = "1") Integer page,
            @RequestParam(name = "limit", required = false,defaultValue = "10") Integer limit,
            String sort, String order,String username,String mobile,String[] statusArray
    ){

        IPage<DtsAccountTrace> ipage = brokerageService.queryPage(page,limit, sort, order, username, mobile,statusArray);
        System.out.println(ipage);
        Map<String,Object> data = new HashMap<>();
        data.put("total", ipage.getTotal() );
        data.put("traceList", ipage.getRecords() );
        return ResponseUtil.ok(data);

    }

}
